#ifndef DATAFILE_H
#define DATAFILE_H

#include <QObject>
#include <QFile>
#include <QDir>
#include <QtCore>

struct DataInfoHeader
{
    char		bfType[4];				//采样数据标识号"VIPC"
    int 		bfSize;					//文件大小
    short		diVer; 					//版本号
    short		diADBit;				//AD精度
    int 		diSize;					//采样数据大小
    double		diSampleFreq;			//采样频率
    short		diChannelNum; 			//总通道数
    short		diCh; 					//采样通道
    float		diSensitivity;			//传感器灵敏度
    char		diTestPointNum[10]; 	//测点号
    int			diMultiple; 			//放大倍数
    char		diUnit[20]; 			//工程单位
    char		diRemark[256]; 			//备注
    char		diDataFlag[4];			//数据开始位置标识"data"(0x61746164)

};

class DataFile : public QObject
{
    Q_OBJECT
public:
    explicit DataFile(QObject *parent = NULL);

    // 变量
    DataInfoHeader DataHeader;
    int HeaderSize;

    // 函数
    void InitHeaderInfo(int Ver, int AdBit, int DataLen, double Freq,
                        int ChNum, int SampCh, QString PointNum, float Sensitivity,
                        int Multiple, QString Unit, QString Remark);
    bool WriteChData(QString FileName, float *SampChData, int DataLen);

signals:

public slots:
};

#endif // DATAFILE_H
